import request from '@/utils/requets'
import { Returnrademark, Records_Data, DataStr } from './type'

export enum API {
    TRAD_URL = '/admin/product/baseTrademark/',
    ADD_URL = '/admin/product/baseTrademark/save',
    UPDATE_URL = '/admin/product/baseTrademark/update',
    UP_FILE = '/api/admin/product/fileUpload',
    DELETE_URL = '/admin/product/baseTrademark/remove/',
}
// 获取品牌信息
export const baseTrademark = (page: number, limit: number) => {
    return request<any, Returnrademark>({
        method: 'get',
        url: `${API.TRAD_URL}${page}/${limit}`,
    })
}

// 是新增还是修改
export const addUpdate = (data: Records_Data) => {
    return request<any, DataStr>({
        method: data.id ? 'put' : 'post',
        url: data.id ? API.UPDATE_URL : API.ADD_URL,
        data,
    })
}

// 删除
export const remove = (id: number | undefined) => {
    return request<any, DataStr>({
        method: 'delete',
        url: API.DELETE_URL + id,
    })
}
